package com.kung.qvs.ui.main.fragment.manage;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.kung.qvs.entity.PrintDataBean;
import com.kung.qvs.entity.ProductBean;

import me.goldze.mvvmhabit.base.ItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

public class FragProductsItem extends ItemViewModel<FragProductsModel> {
    public ObservableField<ProductBean> entity = new ObservableField<>();
    public FragProductsItem(@NonNull FragProductsModel viewModel, ProductBean bean) {
        super(viewModel);
        this.entity.set(bean);
    }

    public BindingCommand itemClickUpdate = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            //这里可以通过一个标识,做出判断，已达到跳入不同界面的逻辑
            viewModel.uc.eventEditProduct.setValue(entity.get());
        }
    });

    public BindingCommand itemClickDelete = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            //这里可以通过一个标识,做出判断，已达到跳入不同界面的逻辑
            viewModel.uc.eventDeleteProduct.setValue(entity.get());
        }
    });
}
